API Documentation
Public Member Functions | List of all members
nkGraphics::ProgramManager Class Referencefinal

Manages the sahders available in the component. More...

Inheritance diagram for nkGraphics::ProgramManager:

Public Member Functions

 ~ProgramManager ()
 
ProgramcreateOrRetrieve (const nkMemory::StringView &name)
 
Programget (const nkMemory::StringView &name)
 
ProgramgetByIndex (unsigned int index)
 
void rename (const nkMemory::StringView &oldName, const nkMemory::StringView &newName)
 
void erase (const nkMemory::StringView &name)
 
unsigned int getIdForInputSemantics (Program *program)
 
void addCustomSemanticIndex (const nkMemory::StringView &semanticName, int assignedIndex)
 
int getCustomSemanticIndex (const nkMemory::StringView &semanticName)
 

Detailed Description

Manages the sahders available in the component.

The manager is responsible for the allocated memory it returns. External code should never delete returned memory.

Constructor & Destructor Documentation

◆ ~ProgramManager()

nkGraphics::ProgramManager::~ProgramManager ( )

Destructor.

Member Function Documentation

◆ createOrRetrieve()

Program* nkGraphics::ProgramManager::createOrRetrieve ( const nkMemory::StringView name)

Creates if unavailable, or retrieve if available, a program.

Parameters
nameThe name of the program to retrieve.
Returns
Requested program, possibly freshly created. The manager owns the memory alloated, external memory should not delete it. See eraseProgram().

◆ get()

Program* nkGraphics::ProgramManager::get ( const nkMemory::StringView name)

Retrieves an existing program.

Parameters
nameThe name of the program to retrieve.
Returns
The program if available, nullptr else.

◆ getByIndex()

Program* nkGraphics::ProgramManager::getByIndex ( unsigned int  index)

Retrieves a program by index. Note that an index can point to different programs as the memory of the manager is changed. Useful to loop over all available programs in one go.

Parameters
indexThe index of the program to retrieve.
Returns
The program linked if available, nullptr else.

◆ rename()

void nkGraphics::ProgramManager::rename ( const nkMemory::StringView oldName,
const nkMemory::StringView newName 
)

Renames a program, changing both its name and the way to find it in the manager.

Parameters
oldNameThe name of the program to alter.
newNameThe new name to assign.

◆ erase()

void nkGraphics::ProgramManager::erase ( const nkMemory::StringView name)

Erases a program and frees its memory.

Parameters
nameThe name of the program to erase.

◆ getIdForInputSemantics()

unsigned int nkGraphics::ProgramManager::getIdForInputSemantics ( Program program)

Allows to retrieve the id associated to an input semantic of a program.

Parameters
programThe program whose input semantic is to inspect.
Returns
The identifier associated to the semantic.

◆ addCustomSemanticIndex()

void nkGraphics::ProgramManager::addCustomSemanticIndex ( const nkMemory::StringView semanticName,
int  assignedIndex 
)

Allows to specify a custom index for semantic tracking.

Parameters
semanticNameThe semantic name to create.
assignedIndexThe index to attach.

◆ getCustomSemanticIndex()

int nkGraphics::ProgramManager::getCustomSemanticIndex ( const nkMemory::StringView semanticName)
Parameters
semanticNameThe semantic name.
Returns
The custom semantic index requested if available, -1 else.

The documentation for this class was generated from the following file: